package org.ofbiz.client;

import java.util.List;

import org.ofbiz.base.util.Debug;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
//import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
//import org.ofbiz.service.GenericDispatcher;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceDispatcher;

public class Echo {
    public static final String module = Echo.class.getName();

    public String echoString(String value) {
	// GenericDelegator delegator = GenericDelegator.getGenericDelegator("default");
//	LocalDispatcher  dispatcher = GenericDispatcher.getLocalDispatcher("default",delegator);
	Delegator delegator = DelegatorFactory.getDelegator("default");
	LocalDispatcher dispatcher = ServiceDispatcher.getLocalDispatcher("default", delegator);

	try {
	    List<GenericValue> list = delegator.findAll("UserLogin", false);
	    for (GenericValue gv : list) {
		value += ";userLoginId=" + gv.getString("userLoginId");
	    }
	} catch (GenericEntityException e) {

	    Debug.logError(e.getMessage(), module);
	}
	// d.runSync(arg0, arg1);
	return "echo:" + value;
    }

}
